package com.ruoyi.system.rpc;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.service.ISysUserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/rpc/user")
public class SysUserRpc {

    @Resource
    private ISysUserService userService;

    @GetMapping("/list")
    public R<List<SysUser>> list(SysUser user) {
        List<SysUser> list = userService.selectUserList(user);
        return R.ok(list);
    }


    @GetMapping(value = {"/{userId}"})
    public R<SysUser> list(@PathVariable(value = "userId") Long userId) {
        SysUser user = userService.selectUserById(userId);
        return R.ok(user);
    }

}
